package fr.upvm.lem3.vm3d.ui.swing.util;

import javax.swing.*;
import java.awt.*;

/**
 * Utility class used to set a Look and feel on a frame 
 *******************************************************************
 *WindowLookAndfeel.java
 *13.02.2012
 *@author Guy Nougouapi
 *******************************************************************
 *
 *******************************************************************
 */

public class MyWindowsLookAndFeel {

  /** Tell system to use native look and feel, as in previous
   *  releases. Metal (Java) LAF is the default otherwise.
   */
  public static void setNativeLookAndFeel(JFrame frame) {
    try { 
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      SwingUtilities.updateComponentTreeUI(frame);
    } catch(Exception e) {
//    	setJavaLookAndFeel(frame);
    }	
  }

  /**
   * tell the system to use the java look and feel. This is the default java look and feel
   * @param frame
   */
  public static void setJavaLookAndFeel(JFrame frame) {
    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      SwingUtilities.updateComponentTreeUI(frame);
    } catch(Exception e) {
    }
  }

   public static void setMotifLookAndFeel(JFrame frame) {
    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
      SwingUtilities.updateComponentTreeUI(frame);
    } catch(Exception e) {
    }
    	
    }
    
    /*
     *  Tell the system to use the gtk look and feel.
     *  This Look and Feel only run on UNIX or Linux systems with GTK+ 2.2 or later installed,
     */
    public static void setGTKLookAndFeel(JFrame frame) {
        try {
          UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
          SwingUtilities.updateComponentTreeUI(frame);
        } catch(Exception e) {
//        	setJavaLookAndFeel(frame);
        }
  }
}
